import { createPinia } from 'pinia'

// 导出modules文件夹下所有模块的实例
import { useUserStore } from './modules/user'
import { useWindowStore} from './modules/window'

const pinia = createPinia()
pinia.use(({ store }) => {

    console.log('use store', store)
    const initialState = JSON.parse(JSON.stringify(store.$state))
    store.$reset = () => {
        console.log('reset store')
        store.$patch(initialState)
    }
})

export default pinia

// 导出useUserStore
export { useUserStore, useWindowStore }